<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use App\Http\Services\RoomServices;
use App\Http\Services\RoomHotServices;

class CommandClearWaitClose extends Command
{
    protected $signature = 'CommandClearWaitClose';

    protected $description = '清理待删除房间';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $services_room = new RoomServices();
        $services_room_hot = new RoomHotServices();

        do {
            for ($i = 0; $i < 100; $i++) {
                $roomId = $services_room->clear_wait_close();
                if (empty($roomId)) {
                    continue;
                }
                $services_room_hot->closeRoom($roomId);
            }
        } while (false);
    }

}